package com.wuzhazha.redisdemo;

import com.wuzhazha.redisdemo.config.RedisConfig;
import com.wuzhazha.redisdemo.config.RootConfig;
import com.wuzhazha.redisdemo.pojo.Role;
import com.wuzhazha.redisdemo.service.RoleService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 测试
 * @Author:wuzhazha
 * @Date: 2018/8/12 01:35
 * @Description:
 */
public class App {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(RootConfig.class, RedisConfig.class);
        //获取角色服务类
        RoleService roleService = ctx.getBean(RoleService.class);
        Role role = new Role();
        role.setRoleName("role_name_1");
        role.setNote("role_note_1");
        //插入角色
        roleService.insertRole(role);
        //获取角色
        Role getRole = roleService.getRole(role.getId());
        getRole.setNote("role_note_1_update");
        //更新角色
        roleService.updateRole(getRole);
    }

}
